package com.maxd.modules.redPacket.dao;

import com.maxd.modules.redPacket.entity.RedPacket;
import com.maxd.modules.redPacket.entity.Storeroom;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface StoreroomRepository extends Repository<Storeroom, Long> {

    @Query(value = "select * from storeroom where classify=:classify and content like  concat('%',:content,'%')  ",
            countQuery = "select count(*) from storeroom where classify=:classify and content like  concat('%',:content,'%') ",
            nativeQuery = true)
    Page<Storeroom> selectStoreroomPageByClassify(Pageable pageable, Integer classify, String content);

    @Query(value = "select * from storeroom where classify=:classify",nativeQuery = true)
    List<Storeroom> selectStoreroomListByClassify(Integer classify);



}